package com.fyzk.activity.lottery.jc.football.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.fyzk.activity.lottery.jc.football.JCInfo;
import com.tyjc.lottery.R;
import com.fyzk.utils.LogUtil;

public class BFGridAdapter extends BaseAdapter {

        private String[] bfs;
        private Context context;

        public BFGridAdapter(JCInfo info, Context context) {
            this.bfs = info.getResult().split(",");
            this.context = context;
        }

        @Override
        public int getCount() {
            return bfs.length;
        }

        @Override
        public Object getItem(int position) {
            return bfs[position];
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            BFHolder holder = null;
            if (convertView == null) {
                convertView = View.inflate(context, R.layout.layout_bf_item, null);
                holder = new BFHolder();
                holder.bfTxt = (TextView) convertView;
                convertView.setTag(holder);
            } else {
                holder = (BFHolder) convertView.getTag();
            }
            holder.bfTxt.setText(bfs[position]);
            return convertView;
        }

        public void setData(JCInfo info) {
            this.bfs = info.getResult().split(",");
            LogUtil.v("this.bfs.length>>>>"+this.bfs.length);
        }

        class BFHolder {
            TextView bfTxt;
        }
    }